#include <iostream>
#include <cstring>
#include <unistd.h>

using namespace std;


void Reader(int rfd)
{
    char buffer[1024];

    while(true)
    {
        buffer[0]=0;   // 清楚上次缓存
        ssize_t n=read(rfd,buffer,sizeof(buffer));   // 写的话可以用strlen 但是读的话必须得用sizeof了
        if(n>0)
        {
            buffer[n]=0;
            cout<<"father get a message {"<< getpid()<<"]#"<<buffer<<endl;
        }

    }
}


int main()
{
    Reader(0);
    return 0;
}
